<div class="center">
	<div class="home">
    	<div class="home_left">
        	<?php echo $this->partial('member/menu.phtml',array('uCount' => $this->uCount,'menuId'=>$this->menuId,'user'=>$this->user,'account'=>$this->account)); ?>
        </div>
    	<div class="home_right">
            <div class="waybill">
                <div class="waybillTop">
                  <h1>我的国际运单</h1>
                  <p>去我的仓库：<a href="/member/mystore/" target="_blank">发送国际运单</a></p>
                </div>
                <div class="waybillTable">
                    <table>                                               
                        <tr>
                            <th class="w1">创建时间</th>
                            <th class="w2">流水号</th>
                            <th class="w3">运单信息</th>
                            <th class="w4">重量</th>
                            <th class="w5">运单状态</th>
                            <th class="w6">操作</th>
                        </tr>
                    </table>
                    <div class="wuyd"<?php if(!empty($this->waybilllist))  echo "style='display: none'"; ?>   >
                    	<h2>您还没有发送过国际运单！</h2>
                        <p>猜您会：<a href="/member/mystore">去我的仓库发送运单</a><i>|</i><a href="/member/instore/">我要预报包裹</a><i>|</i><a href="/purchase/agent">我要代购</a></p>
                    </div>
                    <table>
                        <?php $ad = Application_Model_AdLink::getByCode('way');
                            
                        foreach ($this->waybilllist as  $item){ ?> 
                        <tr>
                            <td class="w1"><p><?php echo date('Y-m-d',strtotime($item->dateCreated));?><span><?php echo date('h:i:s',strtotime($item->dateCreated));?></span></p></td>
                            <td class="w2"><?php echo $item->billNo;?>
                            </td>
                            <td class="w3">
                                <div class="WBinfo">
                                    <h2><?php echo $item->ExpressBy->Name ?>/收件人:<?php echo $item->Consignee;?></h2>
                                    <p>物流编号：<?php  echo ($item->logistics!="")?$item->logistics:"[暂无]";?></p>
                                    <a href="/member/waybillinfo/?id=<?= $item->id?>">运单详情&gt;&gt;</a>
                                </div>
                            </td>
                            <td class="w4"><?php  echo $item->weight;?>&nbsp;g</td>
                            <td class="w5">
                                <?php if($item->Problem != Application_Model_wayBillItem::Problem_Cancel){
                                switch ($item->status)
                                {
                                    case 0:
                                        echo "<div class='WBZT'><a class='waybillfk' href='/pay/paying/type/3/id/".$item->id."'>待付款</a></div>";break;//等待付款
                                    case 1:
                                        echo "<div class='WBZT'><span>已付款，等待受理</span></div>";break;//正在准备
                                    case 2:
                                        echo "<div class='WBZT'><a class='waybillQR' href='javascript:void(0)' name='".($item->id)."'>确认收货</a></div><div class='Track'><a class='Tracklink' href='/member/waybillinfo/?id=".$item->id."'>物流跟踪</a></div>";break;//已经发货
                                    case 100:
                                        echo "<div class='WBZT'><span class='waybillOK'>已完成收货</span></div>";
                                        echo "<div class='Track'><a class='Tracklink' href='/member/waybillinfo/?id=".$item->id."'>物流跟踪</a></div>";
                                        break;//已经完成
                                    case -1:
                                        echo "<div class='WBZT'><span class='waybillAbnormal'>已撤销</span></div>";break;//已撤销
                                    case -2:
                                        echo "<div class='WBZT'><span class='waybillAbnormal'>海关退货</span></div><div class='Track'><a class='Tracklink' href='/member/waybillinfo/?id=".$item->id."'>物流跟踪</a></div>";break;//海关退货
                                    case -4:
                                        echo "<div class='yd_wenti'><a href='/member/waybillinfo/ma/1/?id=".($item->id)."' id='problem_houtai'><i></i>问题运单</a></div>";break;//已撤销
                                    default: 
                                        echo "<div class='WBZT'><span>".$item->statusname."</span></div>";
                                } } else {
                                    echo "<div class='WBZT'><span class='waybillAbnormal'>已撤销</span></div>";
                                }
                                ?>
                            </td>
                            <td class="w6">
                                <?php if($item->status<=1 && $item->status>=0) echo "<div class='waycx'><a href='/member/waybill/?oper=cancel&id=".($item->id)."'>撤销运单</a></div>";?>
                            <div style="padding-left:10px;" onmouseover="setShare('<?= $ad->getTitle($item->ExpressBy->Name) ?>', '<?= $ad->getAdUrl($this->user->id) ?>','<?= $ad->getContent('从中国发送'.($item->weight /1000).'KG到'.$item->cityBy->Name.'只需要'.$item->getFeeByType(Application_Model_FeeType::EstimateShipFee).'元人民币') ?>');"> 
                                <!--自定义第一个分享标题和链接-->
                                <!-- JiaThis Button BEGIN -->
                                <div class="jiathis_style">       
                                <a href="http://www.jiathis.com/share/?uid=1334580904971198" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank">
                                    分享
                                </a>
                                </div>
                                <!-- JiaThis Button END -->
                            </div>
                            </td>
                        </tr>         
                        <?php }?>
                    </table>
                </div>                
                <div class="toolbar" <?php if(empty($this->waybilllist))  echo "style='display: none'"; ?>>
                    <?php echo $this->partial('paging.phtml',array("pages"=>$this->waybills)); ?>
               </div>
            </div>
            
        </div>
    </div>
</div>

<!--单页面使用多分享按钮需要增加的分享参数代码-->                        
<script type="text/javascript">
    function setShare(title, url,content) {
        jiathis_config.title = title;
        jiathis_config.url = url;
        if(content){
          jiathis_config.summary = content;
        }
    }
    var jiathis_config = {};
    $(".waybillQR").click(function(){
        var id = $(this).attr("name");
        if(confirm("您确认该国际运单您已经签收了？","提示信息")){   
            location.href = "/member/waybill/?oper=sign&id="+id;
        }
    });
</script>   
<!--分享参数代码结束-->
<!--分享功能代码统一放到页尾-->
<script type="text/javascript" src="http://v1.jiathis.com/code/jia.js?uid=1334580904971198" charset="utf-8"></script>
<!--分享功能代码结束-->

<?
//如果count=1，证明是首次统计，否则不要进入统计了
if($this->type == 'cancel'){
    //Google追踪代码，一般的都只算是两元收入
    $tid = '3_' . $this->way->id;
    $money = $this->way->getMoney();
    $country = $this->way->CityBy->Name;  //发货国家
    $weight = $this->way->Weight;

    $sku = $this->way->getExpressBy()->Name.'_'. $this->way->CityBy->Name;  //快递名称+国家名称
    $productName = $this->way->getExpressBy()->Name;  //快递名称+国家名称
    $category = $country; //用国家名称进行分类名称，方便统计发的国家
    $unitPrice = $money / $weight;    
?>
<script type="text/javascript">
  _gaq.push(['_addTrans','<?= $tid ?>',  '<?= $productName ?>',  '<?= $money*-1 ?>',null,null,null,null,'<?= $country ?>']);   
  _gaq.push(['_addItem','<?= $tid ?>','<?= $sku ?>','<?= $productName ?>','<?= $category ?>','<?= $unitPrice ?>','<?= $weight*-1 ?>']);
  _gaq.push(['_trackTrans']); 
</script>
<? 
}
?>